package com.kehutong.employee.controller;

import com.kehutong.common.DoveClient;
import com.kehutong.employee.entity.Position;
import com.kehutong.employee.service.PositionService;
import org.coraframework.authz.HasPermission;
import org.coraframework.inject.Inject;
import org.coraframework.json.JSONObject;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.Bean;
import org.coraframework.mvc.http.ReqMapping;

@MvcAction
@ReqMapping("/admin/basic/position")
public class PositionController {

    @Inject
    private PositionService positionService;
	@Inject
    private DoveClient doveClient;

    @ReqMapping("/page")
//    @HasPermission("position:form:view")
    public Object page(JSONObject jsonObject) {
        return positionService.page(jsonObject);
    }

    @ReqMapping("/list")
//    @HasPermission("position:form:view")
    public Object list(JSONObject jsonObject) {
        return positionService.list(jsonObject);
    }

    @ReqMapping("/get")
//    @HasPermission("position:form:view")
    public Object get(Position role) {
        return positionService.get(role);
    }

    @Bean(newInstance=true, copy=true)
//    @HasPermission("position:form:save")
    @ReqMapping("/save")
    public Object save(Position role) {
        return positionService.save(role);
    }

    @Bean(copy=true)
//    @HasPermission("position:form:update")
    @ReqMapping("/update")
    public Object update(Position role) {
        return positionService.update(role);
    }

//    @HasPermission("position:form:delete")
    @ReqMapping("/delete")
    public Object delete(Position role) throws Exception {
        return positionService.delete(role);
    }

    @ReqMapping("/tree")
    public Object tree(JSONObject jsonObject) throws Exception {
        return positionService.tree(jsonObject);
    }

    @ReqMapping("/updateSort")
	public Object updateSort(JSONObject jsonObject) {
        return positionService.updateSort(jsonObject);
	}
}
